package com.klangner.go.model;


/**
 * Points to position on board
 */
public class BoardPosition {

	/** x position */
	private int x;
	/** y position */
  private int y;

  /**
   * constructor
   */
  public BoardPosition(int x, int y) {
        
  	this.x = x;
  	this.y = y;
  }
  
  /**
   * @return x position
   */
  public int getX(){
  	return x;
  }

  /**
   * @return y position
   */
  public int getY(){
  	return y;
  }

  /**
   * compare 2 positions
   */
	public boolean equals(Object obj) {

		if(obj instanceof BoardPosition){
			BoardPosition stone = (BoardPosition)obj;
			return ( x == stone.getX() && y == stone.getY() );
		}
		
		return false;
	}

  /**
   * create hashcode for this object.
   * Required with equals for Set object
   */
	public int hashCode() {

		return x*1000 + y;
	}

  /**
   * convert to string
   */
	public String toString() {
		
		return "(" + x + "," + y + ")";
	}
    
}
